//最⼤数（medium): https://leetcode.cn/problems/largest-number/
class Solution
{
public:
	string largestNumber(vector<int>& nums)
	{
		// 优化：把所有的数转化成字符串
		vector<string> strs;
		for (int x : nums)
		{
			strs.push_back(to_string(x));
		}
		// 排序
		sort(strs.begin(), strs.end(), [](const string& s1, const string& s2)
			{
				return s1 + s2 > s2 + s1;
			});
		// 提取结果
		string ret;
		for (auto& s : strs)
		{
			ret += s;
		}
		if (ret[0] == '0')
		{
			return "0";
		}
		return ret;
	}
};